//
//  MusicListCell.swift
//  Reader
//
//  Created by mn on 2024/9/27.
//

import UIKit

class MusicListCell: UITableViewCell {

    lazy var nameLabel: UILabel = {
        let label = UILabel()
        return label
    }()
    lazy var durtionLabel: UILabel = {
        let label = UILabel()
        label.textColor = UIColor.lightGray
        label.font = UIFont.systemFont(ofSize: 14)
        return label
    }()
    lazy var corverImageView = UIImageView()
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        contentView.addSubview(nameLabel)
        contentView.addSubview(durtionLabel)
        contentView.addSubview(corverImageView)
        corverImageView.snp.makeConstraints { make in
            make.top.equalToSuperview().offset(10)
            make.left.equalToSuperview().offset(20)
            make.bottom.lessThanOrEqualToSuperview().offset(-10)
            make.width.height.equalTo(50)
        }
        nameLabel.snp.makeConstraints { make in
            make.left.equalTo(corverImageView.snp.right).offset(10)
            make.centerY.equalToSuperview()
        }
        durtionLabel.snp.makeConstraints { make in
            make.right.equalToSuperview().offset(-15)
            make.centerY.equalToSuperview()
        }
        durtionLabel.textAlignment = .right
        corverImageView.layer.cornerRadius = 5
        corverImageView.layer.masksToBounds = true
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
